<template>
  <div>
    <div style="box-shadow: 0 0 10px rgba(0,0,0,.1); padding: 10px 20px; border-radius: 5px; margin-bottom: 10px">
      早安，祝你开心每一天！
    </div>
    <div style="display: flex">
      <el-card style="width: 100%;">
        <div slot="header" class="clearfix">
          <span>共享充电事业</span>
        </div>
        <div>
          本系统秉持着共享一家亲，着力整合各家产品优势，统一部署
          <div style="margin-top: 20px">
            <div style="margin: 10px 0"><strong>主题色</strong></div>
            <el-button type="primary">按钮</el-button>
            <el-button type="success">按钮</el-button>
            <el-button type="warning">按钮</el-button>
            <el-button type="danger">按钮</el-button>
            <el-button type="info">按钮</el-button>
          </div>
        </div>
      </el-card>
    </div>
    <div style="display: flex; margin: 15px 0">
      <el-card style="width: 50%; margin-right: 10px">
        <div slot="header" class="clearfix">
          <span style="font-weight: bold; font-size: 20px">系统公告</span>
        </div>
       <el-timeline style="padding: 0">
         <el-timeline-item v-for="item in notices" :key="item.id" :timestamp="item.item" placement="top">
           <el-card>
             <h4>{{item.title}}</h4>
             <p>{{item.content}}</p>
           </el-card>
         </el-timeline-item>
       </el-timeline>
      </el-card>

      <el-card style="width: 50%; margin-right: 10px">
        <div slot="header" class="clearfix">
          <span style="font-weight: bold; font-size: 20px">系统公告</span>
        </div>
        <el-collapse v-model="activeName" accordion>
          <el-collapse-item v-for="(item ,index) in notices" :key="item.id" :name="index + ''">
            <template slot="title">
              <h4>{{item.title}}</h4>
            </template>
<!--            <el-card>-->
<!--              <p>{{item.content}}</p>-->
<!--            </el-card>-->
            <!-- 或者-->
            <div>{{item.content}}</div>
          </el-collapse-item>
        </el-collapse>
      </el-card>
    </div>

  </div>

</template>

<script>

export default {
  name: "Home",
  data() {
    return {
      users: [],
      user: JSON.parse(localStorage.getItem('power-user') || '{}'),
      notices: [],
      activeName: '0',
    }
  },
  mounted() {
    this.loadNotice()
  },
  methods: {
    loadNotice(){
      this.$request.get('/notice/selectUserData').then(res =>{
        this.notices = res.data
      })
    }
  }


}
</script>

<style scoped>

</style>